package seminar;

import org.apache.log4j.Logger;

/**
 * A lecture
 * @author Johannes Degler
 *
 */
public class Lecture {

	private final static Logger log = Logger.getLogger(Lecture.class);

	private final String name;

	/**
	 * A new lecture
	 * @param name Lecture's name
	 */
	public Lecture(final String name){
		Lecture.log.debug("New lecture: " + name);
		this.name = name;

	}


	@Override
	public boolean equals(final Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (this.getClass() != obj.getClass())
			return false;
		final Lecture other = (Lecture) obj;
		if (this.name == null) {
			if (other.name != null)
				return false;
		} else if (!this.name.equals(other.name))
			return false;
		return true;
	}


	/**
	 * Get the lecture's name
	 * @return Lecture's name
	 */
	public String getName() {
		return this.name;
	}


	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ (this.name == null ? 0 : this.name.hashCode());
		return result;
	}


	@Override
	public String toString() {
		return "Lecture [" + this.name + "]";
	}
}
